<?php
namespace Common\Controller;
use Common\Controller\CommonController;
class ZuJiController extends CommonController
{
    //绑定好友关系
    public function make_friend($my_user_id ,$share_uid)
    {
        $field          =   array('user_id');
        $member_data    =   M('zuji_member')->where(array('user_id'=>$share_uid))->field($field)->find();
        if (! empty($member_data))
        {
            if ($member_data['user_id'] != $my_user_id)
            {
                $where_friend                           =   array();
                $where_friend['my_user_id']             =   $my_user_id;
                $where_friend['coupling_user_id']       =   $share_uid;
                $relation_result                        =   M('zuji_relationship')->where($where_friend)->field(array('zuji_relationship_id'))->find();
                if (empty($relation_result))
                {
                    $insert_data                        =   array();
                    $insert_data['my_user_id']          =   $my_user_id;
                    $insert_data['coupling_user_id']    =   $share_uid;
                    $insert_data['createtime']          =   time();
                    M('zuji_relationship')->add($insert_data);
                }
            }

        }
    }

}